package com.itheima.tcp.demo3;

import java.io.*;
import java.net.Socket;

public class ClientDemo {
    public static void main(String[] args) throws IOException {
        Socket s=new Socket("192.168.19.64",10000);
        FileInputStream fis=new FileInputStream("day16_dcp\\clientDir\\1.jpg");
        OutputStream os = s.getOutputStream();
        BufferedInputStream bis=new BufferedInputStream(fis);
        int b;
        while ((b=bis.read())!=-1) {
            os.write(b);

        }
        s.shutdownOutput();

        InputStream is = s.getInputStream();
        BufferedReader br=new BufferedReader(new InputStreamReader(is));
        String line;
        while((line=br.readLine())!=null){
            System.out.println(line);
        }

        s.close();


    }
}
